let path =  require('path');
let {CleanWebpackPlugin} = require('clean-webpack-plugin')
let html = require('html-webpack-plugin')
module.exports = {
  mode:'production',
  entry:"./src/index.js",
  output:{
    filename:"index.[hash:6].js",
    path:path.resolve(__dirname,'dist')
  },
  plugins:[
    new CleanWebpackPlugin(),
    new html({
      template:'./public/index.html',
      filename:'index.html'
    })
  ],
  module:{
    rules:[
      {
        test:/\.css$/,
        use:['style-loader','css-loader']
      },
      {
        test:/\.js$/,
        use:'babel-loader',
        /* use:{
          loader:'babel-loader',
          options:{
            presets:['@babel/preset-env'],
            plugins:[
              ["@babel/plugin-proposal-decorators", { "legacy": true }],
              ['@babel/plugin-proposal-class-properties',{loose:true}],
              ['@babel/plugin-transform-runtime',{
                corejs:3
              }]
            ]
          }
        }, */
        exclude:/node_modules/ // include
      }
    ]
  },
  externals:{
    'jquery':"jQuery",
    
    '$$':"jQuery"
  }
  // devServer:{

  // }
}